﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GraphControls.Views
{
    public partial class NewProject : Form
    {
        private ProjectsControl _projectsControl;

        public NewProject(ProjectsControl projectsControl)
        {
            _projectsControl = projectsControl;
            InitializeComponent();
        }

        private void OkButton_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length > 0)
            {
                _projectsControl.NewProject(textBox1.Text);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show(this, "Введите имя проекта",
                        "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
